package org.scratchcrew.web.cometd;

import org.cometd.Client;

/**
 * Interface describing behavior of a Service which handles Bayeux messages.
 * 
 */
public interface BayeuxMessageHandler {
	/**
	 * Typically a channel will be "/service/**". Which handles all messages
	 * from the sub channels.
	 * 
	 * @return the channel
	 */
	public String getChannelId();

	/**
	 * Handles a message for the channel.
	 * 
	 * @param fromClient
	 *            the sender of the message
	 * @param channel
	 *            the exact channel for the message
	 * @param data
	 *            message data
	 * @param id
	 *            unique if for the message.
	 * @return reply
	 */
	public Object handle(Client fromClient, String channel, Object data,
			String id);

}
